<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>事件</title>
    <style>
    #wk{
        width: 400px;
        height: 400px;
        padding-top: 50px;
        background-color: rgb(20, 36, 255);
    }
    #nk{
        width: 300px;
        height: 300px;
        padding-top: 50px;
        background-color: rgb(253, 253, 255);
    }
    #znk{
        width: 100px;
        height: 100px;
        margin-top: 60px;
        background-color: rgb(228, 15, 25);
        text-align: center;
        color: rgb(15, 15, 15);
    }
    div{
        margin: auto;
       
        }
    </style>
   
</head>
<body>
    <div id="wk">
        <div id="nk">
            <div id="znk">
              内部框
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function event(msg){
            alert("这是"+msg);
        }
        var a=document.getElementById("wk");
        a.onclick = function(){
            event("外框！");
        }
        var b=document.getElementById("nk");
        b.onclick = function(){
            event("中框！");
        }
        var c=document.getElementById("znk");
        c.onclick = function(){
            event("内框！");
        }
    </script>
</body>
</html>